import java.util.Arrays;

public class HuToolTest {
    public static void main(String[] args) {
        int[] arr = {2, 8, 6, 9, 7, 2, 3, 1};

        //在数组中找最大值
        MethodExercise1 ArrayUtil = null;
        int max = ArrayUtil.max(arr);
        System.out.println("max = " + max);//max = 9

        int target = 7;
        //因为数组是无序的，所以不能用二分查找，只能用顺序查找
        int index = ArrayUtil.indexOf(arr, target);
        System.out.println("7的index = " + index);//7的index = 4

        target = 10;
        index = ArrayUtil.indexOf(arr, target);
        System.out.println("10的index = " + index);//10的index = -1

        //反转数组
        ArrayUtil.reverse(arr);
        System.out.println("arr的元素：" + Arrays.toString(arr));
        //arr的元素：[1, 3, 2, 7, 9, 6, 8, 2]

    }
}
